<?php session_start(); $_SESSION['page'] = 'library';?>
<!doctype html public "-//W3C//DTD HTML 4.01//EN">

<html>

   <head>
      <title>Library Profile</title>
      <meta http-equiv="generator" content="PHP Designer 2005" />
      <style type="text/css">
        @import url(style.css);
      </style>
   </head>

   <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000" class=''>

    <form>
    <table width='80%' align='center' class='content'>
        <tr><td colspan='2'><img src='images/banner1.jpg'></td></tr>
            <tr><td align='right' colspan='2' class='logout'><?php require ('loginout.php');?></td></tr>
            <tr class='menuborder'><td width='90%'><img src='images/libprofile.png'></td><td><?php  require('buttons.php'); ?></td></tr>
            <tr><td colspan='2' class='bodyborder'>
            <table align='center'>
                <tr><td height='30'></td></tr>
                <tr><td>Library</td>
                    <td><select name='library'>
                    <?php
                          require('db_connection.php');
                          $query = "SELECT libraryName, libraryNo FROM tbllibrary";
                          $result = mysql_query($query);
                          while ($row = mysql_fetch_array($result))
                            {
                                        $libraryNo = $row['libraryNo'];
                                        $location = $row['libraryName'];
                                        echo"<option value='$libraryNo'>"." $location "." ";
                            }

                    ?>
                        </select>
                    </td>
                    <td><input type='submit' value='View' class='tool'></td>
                </tr>
                <tr><td height='30'></td></tr>
            </table>
            </td>
        </tr>
        <tr><td colspan='2' class='bodyborder'>
            <table align='center' width='70%'>
                <tr><td height='30'></td></tr>
                <?php
                    $libraryNo = $_GET['library'];
                    require('db_connection.php');
                    $query = "SELECT * FROM tbllibrary WHERE libraryNo='$libraryNo'";
                    $result = mysql_query($query);
                    while ($row = mysql_fetch_array($result))
                    {
                        $libraryNo = $row['libraryNo'];
                        $location = $row['libraryName'];
                        $address = $row['address'];
                        $contactNo = $row['contactNo'];
                        $description = $row['description'];
                        $imgfilename = $row['imgfilename'];
                        //echo"<option value='$libraryNo'>"." $location "." ";
                    }

                echo "<tr><td align='center' colspan='2'><a href='images/library/$imgfilename' target='_blank'><img  colspan='2' height='80%' width='50%' src='images/library/$imgfilename'></a></td></tr>";
                    //echo $location;
                echo "<tr><td height='30'></td></tr>";
                echo "<tr align='center' colspan='2' class='td1'><td>Library Name/Municipality: <b>$location</b></td></tr>";
                echo "<tr align='center' colspan='2' class='td2'><td>Address: <b>$address</b></td></tr>";
                echo "<tr align='center' colspan='2' class='td1'><td>Contact No: <b>$contactNo</b></td></tr>";
                echo "<tr align='center' colspan='2' class='td2'><td>Brief Description/History of the Library: <b>$description</td></tr>";
                echo "<tr align='left'>";
                    echo "<table width='60%' align='center' cellspacing='0' cellpadding='3'>";
                        echo "<tr><td height='30'></td></tr>";
                        echo "<hr width='25%'>";
                        echo "<tr align='left'><th colspan='3'>Staffs</th></tr>";
                        echo "<tr><td height='15'></td></tr>";
                        echo "<tr class='listtable'><td><b>Name of Staff</b></td>";
                            echo "<td><b>Designation</b></td>";
                            echo "<td><b>Contact No.</b></td></tr>";
                        require('db_connection.php');
                    $query = "SELECT * FROM tbladmin WHERE libraryNo='$libraryNo' AND userType='staff'";
                    $result = mysql_query($query);
                    while ($row = mysql_fetch_array($result))
                    {
                        $firstName = $row['firstName'];
                        $lastName = $row['lastName'];
                        $userType = $row['userType'];
                        $contactNo = $row['contactNo'];

                        
                        echo "<tr><td class='listborder'>$firstName $lastName</td><td class='listborder'>$userType</td><td class='listborder'>$contactNo</td></tr>";
                    }
                    echo "<tr><td height='30'></td></tr>";
                    ?>
                    </table>
                </tr>
                <tr><td align='center' colspan='2'><?php require ('copyright.php')?></td></tr>
            </table>
            </td>
        </tr>
    </table>
    </form>

   </body>
</html>
